
import request from '@/api/request.js'

const state={
    // uid:uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').info.mid : null,
}

const mutations ={

}

const actions={
	
    orderStat({commit,dispatch,state},parms){//订单统计，只统计当天
        return new Promise((resolve,reject)=>{
            request('/orderStat',{
                mid:this.getters.uid,
            }).then(res=>{
                //console.log(res)
                resolve(res)
            }).catch(err=>{
                ///console.log(err)
                reject(err)
            })
        })
    },
    orderDispose({commit,dispatch,state},parms){//业务处理订单

        return new Promise((resolve,reject)=>{
            request('/orderDispose',{
                mid:this.getters.uid,
                type:parms.type//订单类型，1待指派预约 2已指定预约 3售后申请
            }).then(res=>{
                //console.log(res)
                // console.log(this.getters,'ttttttttttt')
                resolve(res)
            }).catch(err=>{
                ///console.log(err)
                reject(err)
            })
        })
    },
    classifyPage({commit,dispatch,state},parms){//分类
        return new Promise((resolve,reject)=>{
            request('/classifyPage',{bz:parms.bz}).then(res=>{
                resolve(res)
            }).catch(err=>{
                reject(err) 
            })
        })
    },
    getClassProject({commit,dispatch,state},parms){//三级分类获取详情
        return new Promise((resolve,reject)=>{
            request('/getClassProject',{class_id:parms.class_id}).then(res=>{
                resolve(res)
            }).catch(err=>{
                reject(err) 
            })
        })
    },
    serveDetail({commit,dispatch,state},parms){//服务详情
        return new Promise((resolve,reject)=>{
            request('/serveDetail',{service_id:parms.service_id}).then(res=>{
                resolve(res)
            }).catch(err=>{
                reject(err) 
            })
        })
    },
    serveSub({commit,dispatch,state},parms){//预约服务页面
        return new Promise((resolve,reject)=>{
            request('/serveSub',{
                uid:parms.uid*1,
                service_id:parms.service_id*1,
                psid:parms.psid*1,
                bz:parms.bz*1,
            }).then(res=>{
                resolve(res)
            }).catch(err=>{
                reject(err) 
            })
        })
    },
    getPersonList({commit,dispatch,state},parms){//获取服务人员列表
        return new Promise((resolve,reject)=>{
            request('/getPersonList',{
                uid:parms.uid*1,
                qu_id:parms.qu_id*1,//区ID
                pid	:parms.service_id*1,//服务id
                bz:parms.bz*1,
            }).then(res=>{
                resolve(res)
            }).catch(err=>{
                reject(err) 
            })
        })
    },


}

const getters ={

}
export default {
    state,
    mutations,
    actions,
	getters
}